import { dyjHttp as http } from '@/services/http';
import type { ListResult, Limit } from '@/types/api/common';
import type { ArticleListParamsDTO, ArticleListItem } from '@/types/api/crm-content/article';
/**
 * 公告
 * TODO: 未对接， 接口还没有
 */

/** 列表 */
export const getList = (payload: { data: ArticleListParamsDTO; params: Limit }) =>
  http<ListResult<ArticleListItem>, undefined, ArticleListParamsDTO>({
    url: '/api/admin/article',
    params: { ...payload.data, ...payload.params }
  });
/** 详情 */
export const getDetail = (id: string) => http({ url: `/api/admin/article/${id}` });
/** 添加 */
export const add = (data: any) => http({ method: 'post', url: '/api/admin/add', data });
/** 编辑 */
export const edit = (id: string | number, data: any) => http({ method: 'put', url: `/api/admin/article/${id}`, data: data });
/** 删除 */
export const del = (id: string) => http({ method: 'delete', url: `/api/admin/article/${id}` });
